/*
 * Copyright (C) 2025 Tsingteng MicroSystem
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/**
 * @file nfa_rw_t2t.h
 * @brief T2T相关读卡API接口定义
 */

#ifndef _NFA_RW_T2T_H_
#define _NFA_RW_T2T_H_

#include "nci_feature.h"

#if IS_FEATURE_ON(NCI_FEATURE_RW_T2T)

#include "nfa_base.h"
#include "nfa_utils.h"

/**
 * @brief 选择T2T的扇区
 *
 * @param sec_no 扇区号
 *
 * @return 成功返回NCI_STATUS_OK，失败返回其他错误码
 */
tNCI_STATUS nfa_rw_t2t_sector_select(uint8_t sec_no);
/**
 * @brief 读取一页T2T数据（16字节）
 *
 * @param[in] block_no 起始块号
 * @param[out] p_rsp 返回的数据
 *
 * @note 当返回NCI_STATUS_OK时，p_rsp才有效，需要调用nfa_utils_free_rsp释放
 *
 * @return 成功返回NCI_STATUS_OK，失败返回其他错误码
 */
tNCI_STATUS nfa_rw_t2t_read_page(uint8_t block_no, tNCI_RSP *p_rsp);
/**
 * @brief 写入一Block T2T数据（4字节）
 *
 * @param block_no 写入的块号
 * @param p_data 写入的数据，必须至少有4个字节
 *
 * @return 成功返回NCI_STATUS_OK，失败返回其他错误码
 */
tNCI_STATUS nfa_rw_t2t_write_block(uint8_t block_no, const uint8_t *p_data);

#endif // IS_FREATURE_ON(NCI_FEATURE_RW_T2T)

#endif // _NFA_RW_T2T_H_
